﻿Imports System
Imports System.Collections.Generic
Imports System.Configuration
Imports System.Data.SqlClient
Imports System.Linq
Imports System.Web
Imports Forecast.Logica.Enumeradores
Imports Forecast.Logica.Modelos
Namespace Servicios
    Public Class ServSegmentPL
        Public Function SearchSegmentPL(IdCliente As Integer, Year As Integer) As DataTable
            Dim cn As New SqlConnection()
            Dim cmd As New SqlCommand()
            Dim da As SqlDataAdapter
            Dim ds As DataSet

            Dim ConnString As String = ConfigurationManager.ConnectionStrings("ConnStr").ConnectionString.ToString
            cn.ConnectionString = ConnString
            cmd = New SqlCommand()
            cmd.Connection = cn
            cmd.CommandText = "FC_SegmentPL_Search"
            cmd.CommandType = CommandType.StoredProcedure

            cmd.Parameters.Add("@IdCliente", Data.SqlDbType.VarChar)
            cmd.Parameters("@IdCliente").Value = IdCliente
            'cmd.Parameters.Add("@Year", Data.SqlDbType.VarChar)
            'cmd.Parameters("@Year").Value = Year

            da = New SqlDataAdapter()
            da.SelectCommand = cmd
            ds = New DataSet()
            da.Fill(ds)
            Return ds.Tables(0)
        End Function
        Public Function SearchSegmentPL_SoloSegmento(IdEntityF As Integer) As DataTable
            Dim cn As New SqlConnection()
            Dim cmd As New SqlCommand()
            Dim da As SqlDataAdapter
            Dim ds As DataSet

            Dim ConnString As String = ConfigurationManager.ConnectionStrings("ConnStr").ConnectionString.ToString
            cn.ConnectionString = ConnString
            cmd = New SqlCommand()
            cmd.Connection = cn
            cmd.CommandText = "FC_SegmentPL_Search_SoloSegmento"
            cmd.CommandType = CommandType.StoredProcedure

            'cmd.Parameters.Add("@IdEntityF", Data.SqlDbType.VarChar)
            'cmd.Parameters("@IdEntityF").Value = IdEntityF

            da = New SqlDataAdapter()
            da.SelectCommand = cmd
            ds = New DataSet()
            da.Fill(ds)
            Return ds.Tables(0)
        End Function
        Public Function SearchSegmentPL_SoloProductLine(IdEntityF As Integer) As DataTable
            Dim cn As New SqlConnection()
            Dim cmd As New SqlCommand()
            Dim da As SqlDataAdapter
            Dim ds As DataSet

            Dim ConnString As String = ConfigurationManager.ConnectionStrings("ConnStr").ConnectionString.ToString
            cn.ConnectionString = ConnString
            cmd = New SqlCommand()
            cmd.Connection = cn
            cmd.CommandText = "FC_SegmentPL_Search_SoloProductLine"
            cmd.CommandType = CommandType.StoredProcedure

            'cmd.Parameters.Add("@IdEntityF", Data.SqlDbType.VarChar)
            'cmd.Parameters("@IdEntityF").Value = IdEntityF

            da = New SqlDataAdapter()
            da.SelectCommand = cmd
            ds = New DataSet()
            da.Fill(ds)
            Return ds.Tables(0)
        End Function

    End Class
End Namespace

